package cn.yunyichina.provider.base.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;

import cn.yunyichina.provider.base.dao.EhUserDao;
import cn.yunyichina.provider.base.entity.EhUser;
import cn.yunyichina.utils.convert.JsonUtils;

@Service("ehuserServiceImpl")
public class EhUserServiceImpl {

    @Autowired
    private EhUserDao ehUserDao;

  
    public EhUser getEhUserByCardNo(String data, String sessionid) {
    	
    	JSONObject jsonObj = JsonUtils.parseObject(data);
    	if (StringUtils.isEmpty(jsonObj.getString("cardNo"))) {
    		return null;
    	}
    	
    	return ehUserDao.getEhUserByIdNo(jsonObj.getString("cardNo"));
    }
    public EhUser getEhUserByMobile(String data, String sessionid) {
    	
    	JSONObject jsonObj = JsonUtils.parseObject(data);
    	if (StringUtils.isEmpty(jsonObj.getString("mobile"))) {
    		return null;
    	}
    	
    	return ehUserDao.getEhUserByMobile(jsonObj.getString("mobile"));
    }
    
}
